<?php
if(!isset($_SESSION['user'])){
die();
}

require("public/exts/xcrud/xcrud.php");

if($_GET['type']=='user'){
  		$xcrud = Xcrud::get_instance();
        $xcrud->table('users');
		$xcrud->relation('group_id','user_group','id','name');
       

        
      			  $xcrud->change_type('avatar', 'remote_image');
                  $xcrud->fields('username,name,email,avatar,status,active,group_id,facebook,facebook_id', false, 'My Information');
				  $xcrud->fields('date_registered,date_login,ip_register,ip_login,changepass,changename', false, 'Other');
                 $xcrud->theme('bootstrap');
                 $xcrud->table_name('User Manage System');
				 $xcrud->show_primary_ai_column(true);
           
                 
			               
                 echo $xcrud->render();
}


if($_GET['type']=='group'){
	$xcrud = Xcrud::get_instance();
  	 $xcrud->table('user_group');
             
    
        $xcrud->unset_csv();
        $xcrud->unset_print();

        $xcrud->theme('bootstrap');
       $xcrud->table_name('User Group Management');
	   	 $xcrud->show_primary_ai_column(true);
        
        echo $xcrud->render();
}